home *** CD-ROM | disk | FTP | other *** search
- Subject: v23i036: Run a program under a pty session, Part06/06
- Newsgroups: comp.sources.unix
- Approved: rsalz@uunet.UU.NET
- X-Checksum-Snefru: e1cac7b9 4b5d3634 52ea5782 fd74f891
-
- Submitted-by: Dan Bernstein <brnstnd@kramden.acf.nyu.edu>
- Posting-number: Volume 23, Issue 36
- Archive-name: pty/part06
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: err.h file.h file.h.new getopt.h logs.h master.h misc.h
- # patch/TELNET.FTP sigler.h slave.h texts.h util/condom
- # util/excloff.1 util/excloff.c util/exclon.c util/script
- # util/script.tidy util/sess util/tiocsti.1 util/tiocsti.c
- # util/tty.1 util/tty.c
- # Wrapped by rsalz@litchi.bbn.com on Wed Oct 10 10:11:43 1990
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 6 (of 6)."'
- if test -f 'err.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'err.h'\"
- else
- echo shar: Extracting \"'err.h'\" \(385 characters\)
- sed "s/^X//" >'err.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_ERR_H
- X#define PTY_ERR_H
- X
- X#include <errno.h>
- Xextern int errno; /* not always defined in errno.h, grrrr */
- Xextern int sys_nerr;
- Xextern char *sys_errlist[];
- X
- Xextern void fatal();
- Xextern void fatalinfo();
- Xextern void fatalerr();
- Xextern void fatalerr2p();
- Xextern void fatalerrp();
- Xextern void warnerr2();
- X
- X#endif
- END_OF_FILE
- if test 385 -ne `wc -c <'err.h'`; then
- echo shar: \"'err.h'\" unpacked with wrong size!
- fi
- # end of 'err.h'
- fi
- if test -f 'file.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'file.h'\"
- else
- echo shar: Extracting \"'file.h'\" \(224 characters\)
- sed "s/^X//" >'file.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_FILE_H
- X#define PTY_FILE_H
- X
- X#include <sys/file.h>
- X#ifdef BSD
- X#include <limits.h>
- X#endif
- X#include <fcntl.h>
- Xextern long lseek(); /* sigh. */
- X
- X#endif
- END_OF_FILE
- if test 224 -ne `wc -c <'file.h'`; then
- echo shar: \"'file.h'\" unpacked with wrong size!
- fi
- # end of 'file.h'
- fi
- if test -f 'file.h.new' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'file.h.new'\"
- else
- echo shar: Extracting \"'file.h.new'\" \(224 characters\)
- sed "s/^X//" >'file.h.new' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_FILE_H
- X#define PTY_FILE_H
- X
- X#include <sys/file.h>
- X#ifdef BSD
- X#include <limits.h>
- X#endif
- X#include <fcntl.h>
- Xextern long lseek(); /* sigh. */
- X
- X#endif
- END_OF_FILE
- if test 224 -ne `wc -c <'file.h.new'`; then
- echo shar: \"'file.h.new'\" unpacked with wrong size!
- fi
- # end of 'file.h.new'
- fi
- if test -f 'getopt.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'getopt.h'\"
- else
- echo shar: Extracting \"'getopt.h'\" \(250 characters\)
- sed "s/^X//" >'getopt.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_GETOPT_H
- X#define PTY_GETOPT_H
- X
- X/* The following should be in /usr/include/getopt.h but often aren't. */
- Xextern int getopt();
- Xextern char *optarg;
- Xextern int optind;
- X
- X#endif
- END_OF_FILE
- if test 250 -ne `wc -c <'getopt.h'`; then
- echo shar: \"'getopt.h'\" unpacked with wrong size!
- fi
- # end of 'getopt.h'
- fi
- if test -f 'logs.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'logs.h'\"
- else
- echo shar: Extracting \"'logs.h'\" \(169 characters\)
- sed "s/^X//" >'logs.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_LOGS_H
- X#define PTY_LOGS_H
- X
- Xextern long now();
- Xextern int utmp();
- Xextern int wtmp();
- X
- X#endif
- END_OF_FILE
- if test 169 -ne `wc -c <'logs.h'`; then
- echo shar: \"'logs.h'\" unpacked with wrong size!
- fi
- # end of 'logs.h'
- fi
- if test -f 'master.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'master.h'\"
- else
- echo shar: Extracting \"'master.h'\" \(138 characters\)
- sed "s/^X//" >'master.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_MASTER_H
- X#define PTY_MASTER_H
- X
- Xextern void master();
- X
- X#endif
- END_OF_FILE
- if test 138 -ne `wc -c <'master.h'`; then
- echo shar: \"'master.h'\" unpacked with wrong size!
- fi
- # end of 'master.h'
- fi
- if test -f 'misc.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'misc.h'\"
- else
- echo shar: Extracting \"'misc.h'\" \(190 characters\)
- sed "s/^X//" >'misc.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_MISC_H
- X#define PTY_MISC_H
- X
- Xextern int sessdir();
- Xextern char *real_ttyname();
- Xextern void setusername();
- X
- X#endif
- END_OF_FILE
- if test 190 -ne `wc -c <'misc.h'`; then
- echo shar: \"'misc.h'\" unpacked with wrong size!
- fi
- # end of 'misc.h'
- fi
- if test -f 'patch/TELNET.FTP' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patch/TELNET.FTP'\"
- else
- echo shar: Extracting \"'patch/TELNET.FTP'\" \(69 characters\)
- sed "s/^X//" >'patch/TELNET.FTP' <<'END_OF_FILE'
- Xuser anonymous pty
- Xcd pub
- Xtype binary
- Xget telnet.90.06.28.tar.Z
- Xquit
- END_OF_FILE
- if test 69 -ne `wc -c <'patch/TELNET.FTP'`; then
- echo shar: \"'patch/TELNET.FTP'\" unpacked with wrong size!
- fi
- # end of 'patch/TELNET.FTP'
- fi
- if test -f 'sigler.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'sigler.h'\"
- else
- echo shar: Extracting \"'sigler.h'\" \(138 characters\)
- sed "s/^X//" >'sigler.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_SIGLER_H
- X#define PTY_SIGLER_H
- X
- Xextern void sigler();
- X
- X#endif
- END_OF_FILE
- if test 138 -ne `wc -c <'sigler.h'`; then
- echo shar: \"'sigler.h'\" unpacked with wrong size!
- fi
- # end of 'sigler.h'
- fi
- if test -f 'slave.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'slave.h'\"
- else
- echo shar: Extracting \"'slave.h'\" \(135 characters\)
- sed "s/^X//" >'slave.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_SLAVE_H
- X#define PTY_SLAVE_H
- X
- Xextern void slave();
- X
- X#endif
- END_OF_FILE
- if test 135 -ne `wc -c <'slave.h'`; then
- echo shar: \"'slave.h'\" unpacked with wrong size!
- fi
- # end of 'slave.h'
- fi
- if test -f 'texts.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'texts.h'\"
- else
- echo shar: Extracting \"'texts.h'\" \(273 characters\)
- sed "s/^X//" >'texts.h' <<'END_OF_FILE'
- X/* Copyright 1990, Daniel J. Bernstein. All rights reserved. */
- X
- X#ifndef PTY_TEXTS_H
- X#define PTY_TEXTS_H
- X
- Xextern char *ptyauthor[];
- Xextern char *ptyversion[];
- Xextern char *ptycopyright[];
- Xextern char *ptywarranty[];
- Xextern char *ptyusage[];
- Xextern char *ptyhelp[];
- X
- X#endif
- END_OF_FILE
- if test 273 -ne `wc -c <'texts.h'`; then
- echo shar: \"'texts.h'\" unpacked with wrong size!
- fi
- # end of 'texts.h'
- fi
- if test -f 'util/condom' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/condom'\"
- else
- echo shar: Extracting \"'util/condom'\" \(44 characters\)
- sed "s/^X//" >'util/condom' <<'END_OF_FILE'
- X#!/bin/sh
- X# Public domain.
- Xexec pty -0 "$@"
- END_OF_FILE
- if test 44 -ne `wc -c <'util/condom'`; then
- echo shar: \"'util/condom'\" unpacked with wrong size!
- fi
- chmod +x 'util/condom'
- # end of 'util/condom'
- fi
- if test -f 'util/excloff.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/excloff.1'\"
- else
- echo shar: Extracting \"'util/excloff.1'\" \(18 characters\)
- sed "s/^X//" >'util/excloff.1' <<'END_OF_FILE'
- X.so man1/exclon.1
- END_OF_FILE
- if test 18 -ne `wc -c <'util/excloff.1'`; then
- echo shar: \"'util/excloff.1'\" unpacked with wrong size!
- fi
- # end of 'util/excloff.1'
- fi
- if test -f 'util/excloff.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/excloff.c'\"
- else
- echo shar: Extracting \"'util/excloff.c'\" \(110 characters\)
- sed "s/^X//" >'util/excloff.c' <<'END_OF_FILE'
- X/* Public domain. */
- X#include <sys/ioctl.h>
- X
- Xmain()
- X{
- X (void) ioctl(1,(unsigned long) TIOCNXCL,(char *) 0);
- X}
- END_OF_FILE
- if test 110 -ne `wc -c <'util/excloff.c'`; then
- echo shar: \"'util/excloff.c'\" unpacked with wrong size!
- fi
- # end of 'util/excloff.c'
- fi
- if test -f 'util/exclon.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/exclon.c'\"
- else
- echo shar: Extracting \"'util/exclon.c'\" \(110 characters\)
- sed "s/^X//" >'util/exclon.c' <<'END_OF_FILE'
- X/* Public domain. */
- X#include <sys/ioctl.h>
- X
- Xmain()
- X{
- X (void) ioctl(1,(unsigned long) TIOCEXCL,(char *) 0);
- X}
- END_OF_FILE
- if test 110 -ne `wc -c <'util/exclon.c'`; then
- echo shar: \"'util/exclon.c'\" unpacked with wrong size!
- fi
- # end of 'util/exclon.c'
- fi
- if test -f 'util/script' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/script'\"
- else
- echo shar: Extracting \"'util/script'\" \(299 characters\)
- sed "s/^X//" >'util/script' <<'END_OF_FILE'
- X#!/bin/sh
- X# Public domain.
- Xcase "$@" in
- X"") extra=typescript ;;
- X"-a") extra=typescript ;;
- X"-i") extra=typescript ;;
- X"-a -i") extra=typescript ;;
- Xesac
- Xecho "Script started, teeing $@" "$extra"
- X( echo 'Script started on '`date`;
- X pty -s "$SHELL";
- X echo 'Script done on '`date` ) | tee "$@" "$extra"
- END_OF_FILE
- if test 299 -ne `wc -c <'util/script'`; then
- echo shar: \"'util/script'\" unpacked with wrong size!
- fi
- chmod +x 'util/script'
- # end of 'util/script'
- fi
- if test -f 'util/script.tidy' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/script.tidy'\"
- else
- echo shar: Extracting \"'util/script.tidy'\" \(63 characters\)
- sed "s/^X//" >'util/script.tidy' <<'END_OF_FILE'
- X#!/bin/sh
- X# Public domain.
- Xexec sed -e 's/$//' -e 's/[^]//g'
- END_OF_FILE
- echo shar: 2 control characters may be missing from \"'util/script.tidy'\"
- if test 63 -ne `wc -c <'util/script.tidy'`; then
- echo shar: \"'util/script.tidy'\" unpacked with wrong size!
- fi
- chmod +x 'util/script.tidy'
- # end of 'util/script.tidy'
- fi
- if test -f 'util/sess' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/sess'\"
- else
- echo shar: Extracting \"'util/sess'\" \(44 characters\)
- sed "s/^X//" >'util/sess' <<'END_OF_FILE'
- X#!/bin/sh
- X# Public domain.
- Xexec pty -s "$@"
- END_OF_FILE
- if test 44 -ne `wc -c <'util/sess'`; then
- echo shar: \"'util/sess'\" unpacked with wrong size!
- fi
- chmod +x 'util/sess'
- # end of 'util/sess'
- fi
- if test -f 'util/tiocsti.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/tiocsti.1'\"
- else
- echo shar: Extracting \"'util/tiocsti.1'\" \(250 characters\)
- sed "s/^X//" >'util/tiocsti.1' <<'END_OF_FILE'
- X.TH tiocsti 1
- X.SH NAME
- Xtiocsti \- simulate terminal input
- X.SH SYNOPSIS
- X.B tiocsti
- X[
- X.I arg
- X] ...
- X.SH DESCRIPTION
- X.I tiocsti
- X``types'' each of its arguments on the
- Xcurrent terminal, separated by spaces,
- Xas if you had typed them.
- X.SH "SEE ALSO"
- Xtty(4)
- END_OF_FILE
- if test 250 -ne `wc -c <'util/tiocsti.1'`; then
- echo shar: \"'util/tiocsti.1'\" unpacked with wrong size!
- fi
- # end of 'util/tiocsti.1'
- fi
- if test -f 'util/tiocsti.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/tiocsti.c'\"
- else
- echo shar: Extracting \"'util/tiocsti.c'\" \(322 characters\)
- sed "s/^X//" >'util/tiocsti.c' <<'END_OF_FILE'
- X/* Public domain. */
- X#include <sys/ioctl.h>
- X
- Xmain(argc,argv)
- Xint argc;
- Xchar *argv[];
- X{
- X int j;
- X char *s;
- X
- X if (ioctl(3,TIOCGPGRP,(char *) &j) == -1)
- X (void) dup2(0,3);
- X
- X for (j = 1;j < argc;j++)
- X {
- X for (s = argv[j];*s;s++)
- X (void) ioctl(3,TIOCSTI,s);
- X if (j < argc - 1)
- X (void) ioctl(3,TIOCSTI," ");
- X }
- X}
- END_OF_FILE
- if test 322 -ne `wc -c <'util/tiocsti.c'`; then
- echo shar: \"'util/tiocsti.c'\" unpacked with wrong size!
- fi
- # end of 'util/tiocsti.c'
- fi
- if test -f 'util/tty.1' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/tty.1'\"
- else
- echo shar: Extracting \"'util/tty.1'\" \(279 characters\)
- sed "s/^X//" >'util/tty.1' <<'END_OF_FILE'
- X.TH tty 1
- X.SH NAME
- Xtty \- get terminal name
- X.SH SYNOPSIS
- X.B tty
- X[
- X.B\-s
- X]
- X.SH DESCRIPTION
- X.I tty
- Xprints the pathname of the user's terminal,
- Xor
- X``not a tty''
- Xif its input is not a terminal.
- X.I tty \-s
- Xprints nothing.
- X.SH "EXIT VALUE"
- X0 if the input is a terminal,
- X1 if it isn't.
- END_OF_FILE
- if test 279 -ne `wc -c <'util/tty.1'`; then
- echo shar: \"'util/tty.1'\" unpacked with wrong size!
- fi
- # end of 'util/tty.1'
- fi
- if test -f 'util/tty.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'util/tty.c'\"
- else
- echo shar: Extracting \"'util/tty.c'\" \(298 characters\)
- sed "s/^X//" >'util/tty.c' <<'END_OF_FILE'
- X/* Public domain. */
- X
- Xextern char *ttyname();
- X
- Xmain(argc,argv)
- Xint argc;
- Xchar *argv[];
- X{
- X char *s;
- X
- X s = ttyname(0);
- X
- X if ((argc != 2)
- X ||(argv[1][0] != '-') || (argv[1][1] != 's') || (argv[1][2] != '\0'))
- X if (s)
- X (void) puts(s);
- X else
- X (void) puts("not a tty");
- X (void) exit(!s);
- X}
- END_OF_FILE
- if test 298 -ne `wc -c <'util/tty.c'`; then
- echo shar: \"'util/tty.c'\" unpacked with wrong size!
- fi
- # end of 'util/tty.c'
- fi
- echo shar: End of archive 6 \(of 6\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 6 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
- exit 0 # Just in case...
-